﻿using ChurchDiary.BLL;
using ChurchDiary.TableEntity;
using ChurchWebsite.Controllers;
using CrystalDecisions.CrystalReports.Engine;
using Rotativa;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ChurchWebsite.Areas.Admin.Controllers
{
    public class ChurchWorkersController : BaseController
    {
        //
        // GET: /Admin/ChurchWorkers/
        #region ChurchWorker
        public ActionResult Index()
        {
            return View();
        }
        public JsonResult AddChurchWorker(EntityChurchWorker ChurchWorker)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.InsertChurchWorker(ChurchWorker), JsonRequestBehavior.AllowGet);
        }
        public JsonResult UpdateChurchWorker(EntityChurchWorker ChurchWorker)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.UpdateChurchWorker(ChurchWorker), JsonRequestBehavior.AllowGet);
        }
        public JsonResult DeleteChurchWorker(Guid dataId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.DeleteChurchWorker(dataId), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetChurchWorkers(int PageNo, string SearchKey, string Sort, string SortMode, int PerPage)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.GetChurchWorker(PageNo, SearchKey, Sort, SortMode, PerPage), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetChurchWorker(Guid dataId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.GetChurchWorker(dataId), JsonRequestBehavior.AllowGet);
        }

        public AsPdfResultBase PrintChurchWorkerDetails(Guid ChurchWorkerId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return new Rotativa.ViewAsPdf("PrintChurchWorkerDetails", CW.GetChurchWorker(ChurchWorkerId));
        }
        #endregion ChurchWorker
        #region ChurchWorkerInfo
        public ActionResult ChurchWorkerInfo()
        {
            return View();
        }
        #endregion ChurchWorkerInfo
        #region ChurchWorker Family
        public ActionResult _ChurchWorkerFamily()
        {
            return PartialView();
        }
        public JsonResult AddChurchWorkerfamily(EntityChurchWorkerFamilyDetails ChurchWorkerFamilyDetails)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.InsertChurchWorkerfamily(ChurchWorkerFamilyDetails), JsonRequestBehavior.AllowGet);
        }
        public JsonResult UpdateChurchWorkerfamily(EntityChurchWorkerFamilyDetails ChurchWorkerFamilyDetails)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.UpdateChurchWorkerfamily(ChurchWorkerFamilyDetails), JsonRequestBehavior.AllowGet);
        }
        public JsonResult DeleteChurchWorkerfamily(Guid dataId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.DeleteChurchWorkerfamily(dataId), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetChurchWorkerfamily(int PageNo, string SearchKey, string Sort, string SortMode, int PerPage,Guid ChurchWorkerId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.GetChurchWorkerFamily(PageNo, SearchKey, Sort, SortMode, PerPage, ChurchWorkerId), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetChurchWorkerfamilyByChurchWorker(Guid dataId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.GetChurchWorkerFamily(dataId), JsonRequestBehavior.AllowGet);
        }
        #endregion
        #region ChurchWorker Documents
        public ActionResult _ChurchWorkerDocuments()
        {
            return PartialView();
        }
        public JsonResult AddChurchWorkerDocuments(EntityChurchWorkerDocuments Document)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.InsertChurchWorkerDocuments(Document), JsonRequestBehavior.AllowGet);
        }
        public JsonResult UpdateChurchWorkerDocuments(EntityChurchWorkerDocuments Document)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.UpdateChurchWorkerDocuments(Document), JsonRequestBehavior.AllowGet);
        }
        public JsonResult DeleteChurchWorkerDocuments(Guid dataId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.DeleteChurchWorkerDocuments(dataId), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetChurchWorkerDocuments(int PageNo, string SearchKey, string Sort, string SortMode, int PerPage, Guid ChurchWorkerId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.GetChurchWorkerDocuments(PageNo, SearchKey, Sort, SortMode, PerPage, ChurchWorkerId), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetChurchWorkerDocument(Guid dataId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.GetChurchWorkerDocuments(dataId), JsonRequestBehavior.AllowGet);
        }
        #endregion
        #region ChurchWorker KnownLanguages
        public ActionResult _ChurchWorkerKnownLanguages()
        {
            return PartialView();
        }
        public JsonResult AddKnownLanguage(EntityChurchWorkerKnownlanguages Knownlanguage)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.InsertChurchWorkerKnownlanguages(Knownlanguage), JsonRequestBehavior.AllowGet);
        }
        public JsonResult UpdateKnownLanguage(EntityChurchWorkerKnownlanguages Knownlanguage)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.UpdateChurchWorkerKnownlanguages(Knownlanguage), JsonRequestBehavior.AllowGet);
        }
        public JsonResult DeleteKnownLanguage(Guid dataId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.DeleteChurchWorkerKnownlanguages(dataId), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetKnownLanguages(int PageNo, string SearchKey, string Sort, string SortMode, int PerPage, Guid ChurchWorkerId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.GetChurchWorkerKnownlanguages(PageNo, SearchKey, Sort, SortMode, PerPage, ChurchWorkerId), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetKnownLanguage(Guid dataId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.GetChurchWorkerKnownlanguages(dataId), JsonRequestBehavior.AllowGet);
        }
        #endregion
        #region ChurchWorker History
        public ActionResult _ChurchWorkerHistory()
        {
            return PartialView();
        }
        public JsonResult AddChurchWorkerHistory(EntityChurchWorkerHistroy Histroy)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.InsertChurchWorkerHistroy(Histroy), JsonRequestBehavior.AllowGet);
        }
        public JsonResult UpdateChurchWorkerHistory(EntityChurchWorkerHistroy Histroy)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.UpdateChurchWorkerHistroy(Histroy), JsonRequestBehavior.AllowGet);
        }
        public JsonResult DeleteChurchWorkerHistory(Guid dataId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.DeleteChurchWorkerHistroy(dataId), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetChurchWorkerHistorys(int PageNo, string SearchKey, string Sort, string SortMode, int PerPage, Guid ChurchWorkerId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.GetChurchWorkerHistroy(PageNo, SearchKey, Sort, SortMode, PerPage, ChurchWorkerId), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetChurchWorkerHistory(Guid dataId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.GetChurchWorkerHistroy(dataId), JsonRequestBehavior.AllowGet);
        }
        #endregion
        #region ChurchWorker Ordinations
        public ActionResult _ChurchWorkerOrdinations()
        {
            return PartialView();
        }
        public JsonResult GetChurchWorkerOrdination(Guid ChurchWorkerId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.GetChurchWorkerOrdination(ChurchWorkerId), JsonRequestBehavior.AllowGet);
        }
        public JsonResult AddChurchWorkerOrdination(List<EntityChurchWorkerOrdinations> Ordinations)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.InsertChurchWorkerOrdinations(Ordinations), JsonRequestBehavior.AllowGet);
        }
        public JsonResult DeleteChurchWorkerOrdination(Guid dataId)
        {
            BLL_ChurchWorker CW = new BLL_ChurchWorker();
            return Json(CW.DeleteChurchWorkerOrdinations(dataId), JsonRequestBehavior.AllowGet);
        }
        #endregion
        
    }
}
